package com.deduction.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.base.common.persistence.Page;
import com.deduction.model.ProjectExternalEmployee;
import com.deduction.service.ProjectDeviceService;

@Controller
public class ProjectDeviceController {
	// 页面actionView的地址
	public static final String todeviceView = "/deduction/device";
	public static final String deviceList = "/deduction/device/list";
	public static final String deviceEdit = "/deduction/device/edit";
	public static final String deviceDelete = "/deduction/device/delete";

	// 页面路径
	public static final String devicePage = "/deduction/device";
	
	@Autowired
	ProjectDeviceService projectDeviceService;
	
	@RequestMapping(value = todeviceView, method = RequestMethod.POST)
	public ModelAndView todeviceView() {
		ModelAndView mv = new ModelAndView(devicePage);
		return mv;
	}
	
	@ResponseBody
	@RequestMapping(value = deviceList, method = RequestMethod.POST)
	public Page deviceList(HttpServletRequest req, HttpServletResponse res,	Page page, String projectId) {
		try {
			page = projectDeviceService.findProjectDevicePageByProjectId(projectId, page);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return page;
	}
}
